﻿@using Web.HelperClasses.Inflexion

@helper Nice(DateTime? date, string className, string dummy)
	{
	<span class="@className">@(date.HasValue ? date.Value.ToShortDateString() : dummy)</span>
	}

@helper NiceDaysLeft(IWordFormatter wordFormatter, DateTime? date, string className, string dummy)
	{
     if(date.HasValue)
     {
        var daysLeft = (int) (date.Value.Date - DateTime.Now.Date).Days;
	    <span class="@className">@date.Value.ToShortDateString()</span>
          if(daysLeft > 1){
	      <span>
            @String.Format("(осталось {0} {1})", daysLeft, wordFormatter.GetNumericalWordForm((string)"день", daysLeft))
          </span>
          }else if (daysLeft == 1)
          {
            <span>(Завтра)</span>
          
          }else if (daysLeft == 0)
          {
            <span>(Сегодня)</span>
          }
     }
     else
     {
         <span>@dummy</span>
     }
        
     
	}


    @helper NiceTime(DateTime? date, string classNameHour, string classNameMinute, string dummy)
	{
     if(date.HasValue)
     {
	      <span class="@classNameHour">@date.Value.Hour</span>@::<span class="@classNameMinute">@date.Value.Minute.ToString("00")</span>
     }
     else
     {
         <span>@dummy</span>
     }
        
     
	}